]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
viewSelector: Move 'toggle-applications-view' to ControlsManager
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Sat, 2 Jan 2021 20:41:54 +0000 (17:41 -0300)
committerMarge Bot <marge-bot@gnome.org>
Thu, 11 Feb 2021 15:50:31 +0000 (15:50 +0000)
Move the shortcut handling into ControlsManager, and reimplement
the callback in such a way that it behaves correctly with the
current overview machinery.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1624>

js/ui/overviewControls.js
js/ui/viewSelector.js

index f836f822eaa9c6da1ac36d0b615e2ad190fdf2f0..c0998983b1043bf6581b0b7be034b6e67f66580c 100644 (file)
@@ -1,11 +1,13 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported ControlsManager */
 
-const { Clutter, GObject, St } = imports.gi;
+const { Clutter, Gio, GObject, Meta, Shell, St } = imports.gi;
 
 const Dash = imports.ui.dash;
+const Main = imports.ui.main;
 const Overview = imports.ui.overview;
 const ViewSelector = imports.ui.viewSelector;
+const WindowManager = imports.ui.windowManager;
 
 var SIDE_CONTROLS_ANIMATION_TIME = Overview.ANIMATION_TIME;
 
@@ -142,6 +144,13 @@ class ControlsManager extends St.Widget {
         this.dash.showAppsButton.connect('notify::checked',
             this._onShowAppsButtonToggled.bind(this));
 
+        Main.wm.addKeybinding(
+            'toggle-application-view',
+            new Gio.Settings({ schema_id: WindowManager.SHELL_KEYBINDINGS_SCHEMA }),
+            Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
+            Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
+            this._toggleAppsPage.bind(this));
+
         this.connect('destroy', this._onDestroy.bind(this));
     }
 
@@ -160,6 +169,15 @@ class ControlsManager extends St.Widget {
         });
     }
 
+    _toggleAppsPage() {
+        if (Main.overview.visible) {
+            const checked = this.dash.showAppsButton.checked;
+            this.dash.showAppsButton.checked = !checked;
+        } else {
+            Main.overview.show(ControlsState.APP_GRID);
+        }
+    }
+
     _onDestroy() {
         global.workspace_manager.disconnect(this._nWorkspacesNotifyId);
     }
index 1abdf9cff219d19f498e8e8dd835c495e739c502..11228749bdb7a8cc87abd629401e4c35bf8eb984 100644 (file)
@@ -1,7 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported ViewSelector */
 
-const { Clutter, Gio, GObject, Meta, Shell, St } = imports.gi;
+const { Clutter, GObject, Meta, Shell, St } = imports.gi;
 const Signals = imports.signals;
 
 const AppDisplay = imports.ui.appDisplay;
@@ -351,13 +351,6 @@ var ViewSelector = GObject.registerClass({
             }
         });
 
-        Main.wm.addKeybinding('toggle-application-view',
-                              new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
-                              Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
-                              Shell.ActionMode.NORMAL |
-                              Shell.ActionMode.OVERVIEW,
-                              this._toggleAppsPage.bind(this));
-
         let side;
         if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
             side = St.Side.RIGHT;
@@ -386,11 +379,6 @@ var ViewSelector = GObject.registerClass({
             Main.overview.show();
     }
 
-    _toggleAppsPage() {
-        this._showAppsButton.checked = !this._showAppsButton.checked;
-        Main.overview.show();
-    }
-
     prepareToEnterOverview() {
         this.show();
         this.reset();